//
//  ZHProductScreening.m
//  sc-cyan-ios
//
//  Created by lj on 2017/12/29.
//  Copyright © 2017年 greenbuilding. All rights reserved.
//

#import "ZHProductScreening.h"

#import "ZHProductScreeningChild.h"

@implementation ZHProductScreening

+(NSDictionary *)mj_objectClassInArray
{
    return @{
             @"child" : @"ZHProductScreeningChild"
             };
}

- (CGFloat)sectionItemW{
    if (_sectionItemW) {
        return _sectionItemW;
    }
    
    CGFloat max = 30;

    for (ZHProductScreeningChild *child in self.child ) {
    
        if (max < child.itemW) {
            max = child.itemW;
        }
    }
    
    int row = (Main_Screen_Width - 20) / (max + 10);
    
    //最多为5列
    if (row > 5) {
        row = 5;
    }
    //最少为2列
    if (row < 2) {
        row = 2;
    }
    max = (self.supW - 20 - (row -1) * 10) / row;
    
    return max;
}



@end
